using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class SO_PHAMTMap : EntityTypeConfiguration<SO_PHAMT>
    {
        public SO_PHAMTMap()
        {
            // Primary Key
            this.HasKey(t => new { t.ITEM, t.description, t.PHYSICIAN, t.PERCENTAGE, t.Transactio_Id, t.SUMFIELDS, t.DIMFIELDS });

            // Properties
            this.Property(t => t.BILL__)
                .HasMaxLength(8);

            this.Property(t => t.Transaction_id)
                .HasMaxLength(8);

            this.Property(t => t.ITEM)
                .IsRequired()
                .HasMaxLength(10);

            this.Property(t => t.description)
                .IsRequired()
                .HasMaxLength(250);

            this.Property(t => t.PHYSICIAN)
                .IsRequired()
                .HasMaxLength(35);

            this.Property(t => t.CURRENCY)
                .HasMaxLength(5);

            this.Property(t => t.Year)
                .HasMaxLength(5);

            this.Property(t => t.Transactio_Id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.Month)
                .HasMaxLength(2);

            this.Property(t => t.Guarantor_1)
                .HasMaxLength(50);

            this.Property(t => t.Guarantor_2)
                .HasMaxLength(50);

            this.Property(t => t.Physician_id)
                .HasMaxLength(6);

            this.Property(t => t.SUMFIELDS)
                .IsRequired()
                .HasMaxLength(153);

            this.Property(t => t.DIMFIELDS)
                .IsRequired()
                .HasMaxLength(45);

            // Table & Column Mappings
            this.ToTable("SO_PHAMT");
            this.Property(t => t.BILL__).HasColumnName("BILL_#");
            this.Property(t => t.Transaction_id).HasColumnName("Transaction_id");
            this.Property(t => t.ITEM).HasColumnName("ITEM");
            this.Property(t => t.description).HasColumnName("description");
            this.Property(t => t.PHYSICIAN).HasColumnName("PHYSICIAN");
            this.Property(t => t.PERCENTAGE).HasColumnName("PERCENTAGE");
            this.Property(t => t.CURRENCY).HasColumnName("CURRENCY");
            this.Property(t => t.date).HasColumnName("date");
            this.Property(t => t.Year).HasColumnName("Year");
            this.Property(t => t.Transactio_Id).HasColumnName("Transactio_Id");
            this.Property(t => t.Month).HasColumnName("Month");
            this.Property(t => t.Guarantor_1).HasColumnName("Guarantor_1");
            this.Property(t => t.Guarantor_2).HasColumnName("Guarantor_2");
            this.Property(t => t.PHYSICIAN_AMOUNT_Base_1).HasColumnName("PHYSICIAN_AMOUNT_Base_1");
            this.Property(t => t.PHYSICIAN_AMOUNT_Base_2).HasColumnName("PHYSICIAN_AMOUNT_Base_2");
            this.Property(t => t.GUARANTOR_1_AMOUNT_Base_1).HasColumnName("GUARANTOR_1_AMOUNT_Base_1");
            this.Property(t => t.GUARANTOR_1_AMOUNT_Base_2).HasColumnName("GUARANTOR_1_AMOUNT_Base_2");
            this.Property(t => t.GUARANTOR_2_AMOUNT_Base_1).HasColumnName("GUARANTOR_2_AMOUNT_Base_1");
            this.Property(t => t.GUARANTOR_2_AMOUNT_Base_2).HasColumnName("GUARANTOR_2_AMOUNT_Base_2");
            this.Property(t => t.Physician_id).HasColumnName("Physician_id");
            this.Property(t => t.SUMFIELDS).HasColumnName("SUMFIELDS");
            this.Property(t => t.DIMFIELDS).HasColumnName("DIMFIELDS");
        }
    }
}
